const { readFileSync, writeFileSync } = require('fs')

const jsonPath = './src/pages.json'
const vantJson = require('./env_config.json').vant

const data = readFileSync(jsonPath, 'utf8')
const oldJson = JSON.parse(data)
const newJson = () => {
    const _oldJson = JSON.parse(JSON.stringify(oldJson))
    _oldJson.globalStyle.usingComponents = vantJson
    return JSON.stringify(_oldJson)
}
writeFileSync(jsonPath, newJson())
console.log('pages.json: usingComponents 编译完成！')